package com.putao.album.base;

import android.content.Context;
import android.widget.BaseAdapter;

import java.util.List;

/**
 * Created by jidongdong on 15/4/29.
 */
public abstract class PtBaseAdapter<T extends BaseItem> extends BaseAdapter {
    protected Context mContext;
    protected List<T> mDatalist;

    public PtBaseAdapter(Context context, List<T> datalist) {
        mContext = context;
        mDatalist = datalist;
    }

    @Override
    public int getCount() {
        return mDatalist == null ? 0 : mDatalist.size();
    }

    @Override
    public T getItem(int position) {
        return mDatalist == null ? null : mDatalist.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

}
